﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OS
{
    class Track
    {
        private int trackID;         // The ID of the track
        private char[] data;         // The char[] containing the data of the track
        private bool isFree;         // The boolean value of if the track is free

        /// <summary>
        /// Default constructor
        /// </summary>
        public Track()
        {
            trackID = -1;
            data = new char[40];
            isFree = true;
        }

        /// <summary>
        /// Overloaded constructor
        /// </summary>
        /// <param name="id">The int containing the track ID</param>
        public Track(int id)
        {
            trackID = id;
            data = new char[40];
            isFree = true;
        }

        /// <summary>
        /// Overloaded constructor
        /// </summary>
        /// <param name="id">The int containing the track ID</param>
        /// <param name="dta">The char[] containing the data of the track</param>
        public Track(int id, char[] dta)
        {
            trackID = id;
            isFree = false;
            data = dta;

            char[] temp = new char[40];

            if (dta.Length < 40)
            {
                for (int i = 0; i < dta.Length; i++)
                {
                    temp[i] = dta[i];
                }

                for (int i = dta.Length; i < 40 - dta.Length; i++)
                {
                    temp[i] = ' ';
                }
            }

            data = temp;
        }

        /// <summary>
        /// Getter/setter for trackID
        /// </summary>
        public int TrackID
        {
            get { return trackID; }
            set { trackID = value; }
        }

        /// <summary>
        /// Getter/setter for data
        /// </summary>
        public char[] Data
        {
            get { return data; }
            set { data = value; }
        }


        /// <summary>
        /// Getter/setter for isFree
        /// </summary>
        public bool IsFree
        {
            get { return isFree; }
            set { isFree = value; }
        }
    }
}
